﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VersionSwitcher.Loggers;
using VersionSwitcher.Constants;
using System.Diagnostics;

namespace VersionSwitcher.Workers
{
    public class PackageLoaderWorker
    {
        private FileWorker fileWorker;
        private SvnWorker svnWorker;
        private ILogger logger;

        public PackageLoaderWorker(FileWorker fileWorker, SvnWorker svnWorker, ILogger logger)
        {
            this.fileWorker = fileWorker;
            this.svnWorker = svnWorker;
            this.logger = logger;
        }

        public void Initialize()
        {
            fileWorker.CreateSubFolder(FolderFilePaths.Nd_src);
            fileWorker.CreateSubFolder(FolderFilePaths.Nd_src + FolderFilePaths.Gene);
            svnWorker.SaveFile(FolderFilePaths.ConfigGene, fileWorker.MainFolderPath + FolderFilePaths.Nd_src + FolderFilePaths.Gene);
            fileWorker.CopyFile(fileWorker.GetCurrentDirectory() + FolderFilePaths.CsmWp, fileWorker.MainFolderPath + FolderFilePaths.CsmWp, true);
            fileWorker.CopyFile(fileWorker.GetCurrentDirectory() + FolderFilePaths.PackageLoader, fileWorker.MainFolderPath + FolderFilePaths.PackageLoader, true);
        }

        public void Start()
        {
            Process.Start(fileWorker.MainFolderPath + FolderFilePaths.PackageLoader, Arguments.Download);
        }
    }
}
